var e = require("../../../../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../../../../@babel/runtime/regenerator")), r = require("../../../../../../@babel/runtime/helpers/objectSpread2"), t = require("../../../../../../@babel/runtime/helpers/asyncToGenerator"), a = getApp();

Component({
    properties: {
        memberId: {
            type: null
        },
        userMember: {
            type: null
        },
        keywork: {
            type: null
        }
    },
    data: {
        strUrl: "plugin.wechat-chat-sidebar.frontend.controller.customer.customer.get-user-info",
        getConfig: {
            client: "work",
            type: 17
        },
        userInfo: "",
        memberInfo: "",
        bankCard: {}
    },
    lifetimes: {
        attached: function() {
            console.log(this.data.keywork), this.getData();
        }
    },
    methods: {
        getData: function() {
            var n = this;
            return t(e.default.mark(function t() {
                var o;
                return e.default.wrap(function(e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        if ("customer" != n.data.keywork) {
                            e.next = 3;
                            break;
                        }
                        return n.setData({
                            userInfo: n.data.userMember,
                            memberInfo: n.data.userMember,
                            bankCard: n.data.userMember.bank_card
                        }), e.abrupt("return");

                      case 3:
                        try {
                            o = a.getNetAddresss(n.data.strUrl), a._postNetWork({
                                url: o,
                                data: r(r({}, n.data.getConfig), n.data.memberId),
                                success: function(e) {
                                    var r = e.data;
                                    1 == r.result ? n.setData({
                                        userInfo: r.data,
                                        memberInfo: r.data.yz_member,
                                        bankCard: r.data.bankCard
                                    }) : wx.showToast({
                                        icon: "none",
                                        title: r.msg,
                                        duration: 1500
                                    });
                                },
                                fail: function(e) {
                                    console.log(e);
                                }
                            });
                        } catch (e) {
                            console.log("接口报错::", e);
                        }

                      case 4:
                      case "end":
                        return e.stop();
                    }
                }, t);
            }))();
        }
    }
});